package com.pioneer.web.sale.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.pioneer.web.sale.domain.SalContract;
import com.pioneer.web.sale.domain.SalOrder;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * ISalOrderService
 *
 * @author hlm
 * @date 2025-04-30 15:10:11
 */
public interface ISalOrderService extends IService<SalOrder> {

    /**
     * 根据销售合同生成销售订单
     * @param salContract 销售合同
     * @return 结果
     */
    @Transactional(rollbackFor = Exception.class)
    boolean genOrderByContract(SalContract salContract);

    /**
     * 根据销售合同删除销售订单
     * @param salContract 销售合同
     * @return 结果
     */
    @Transactional(rollbackFor = Exception.class)
    boolean delOrderByContract(SalContract salContract);

    /**
     * 根据销售订单ID查询详情
     * @param orderId 销售订单ID
     * @return 结果
     */
    SalOrder getOrderById(Long orderId);

    /**
     * 修改销售订单
     * @param order 销售订单
     * @return 结果
     */
    @Transactional(rollbackFor = Exception.class)
    boolean updateOrderById(SalOrder order);

    /**
     * 提交销售订单
     * @param orderIdList 销售订单ID集合
     * @return 结果
     */
    boolean commitOrder(List<Long> orderIdList);

    /**
     * 撤回销售订单
     * @param orderIdList 销售订单ID集合
     * @return 结果
     */
    boolean recallOrder(List<Long> orderIdList);

    /**
     * 审批销售订单
     * @param order 销售订单
     * @return 结果
     */
    boolean approveOrder(SalOrder order);

    /**
     * 弃审销售订单
     * @param order 销售订单
     * @return 结果
     */
    boolean unapproveOrder(SalOrder order);
}
